﻿using System;
using Controller;
using Model;

public partial class ACPanel_NodeTour_DeleteTourDiemDen : System.Web.UI.Page
{
    public static int _id;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            var id = Request.QueryString["Id"];
            if (id != null)
            {
                _id = Convert.ToInt32(id);
                litIdChuyenmuc.Text = id;
            }
        }
    }

    public int DeleteObject(ModelVYC0301 model)
    {
        var controller = new VYC0301Controller();
        return controller.DeleteData(model);
    }

    protected void btnHuy_OnClick(object sender, EventArgs e)
    {
        Response.Redirect("~/ACPanel/NodeTour/QLTourDiemDen.aspx");
    }

    protected void btnXoa_OnClick(object sender, EventArgs e)
    {
        var model = new ModelVYC0301 { Id = _id };
        Response.Redirect(DeleteObject(model) > 0 ? "~/ACPanel/NodeTour/QLTourDiemDen.aspx" : "~/ACPanel/Error.aspx");
    }
}